<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%--
  Created by IntelliJ IDEA.
  User: JMS
  Date: 2020/12/29
  Time: 20:48
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>

<head>
    <meta charset="utf-8"/>
    <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
    <title>报修处理页面</title>
    <!-- Bootstrap Styles-->
    <link rel="stylesheet" href="../../static/bootstrap/css/bootstrap.css"/>
    <!-- FontAwesome Styles-->
    <link rel="stylesheet" href="../../static/font-awesome-4.7.0/css/font-awesome.css"/>
    <link rel="stylesheet" href="../../static/font-awesome-4.7.0/css/custom-styles.css"/>
    <link rel="stylesheet" href="../../static/css/style_x.css">
    <script src="../../static/bootstrap/jquery-3.5.1.min.js"></script>
    <script src="../../static/bootstrap/js/popper.js"></script>
    <script src="../../static/bootstrap/js/bootstrap.js"></script>

</head>

<body>
<div id="wrapper">
    <nav class="top-navbar">
        <div class="navbar-header">
            <strong class="navbar-brand">管理员功能菜单</strong>
        </div>
    </nav>
</div>

<!--/. NAV TOP  -->
<div class="row">
    <div class="col-2">

        <nav class="navbar-side" role="navigation">
            <div class="sidebar-collapse">
                <ul class="nav" id="main-menu">
                    <li>
                        <a href="../../pages/admin/getApplyList.jsp"><i class="fa fa-dashboard"></i> 租赁管理</a>
                    </li>
                    <li class="active-menu">
                        <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor"
                             class="bi bi-caret-right" viewBox="0 0 16 16">
                            <path fill-rule="evenodd"
                                  d="M6 12.796L11.481 8 6 3.204v9.592zm.659.753l5.48-4.796a1 1 0 0 0 0-1.506L6.66 2.451C6.011 1.885 5 2.345 5 3.204v9.592a1 1 0 0 0 1.659.753z"/>
                        </svg>
                        <a href="../../pages/admin/getRepairList.jsp"><i class="fa fa-desktop"></i> 报修处理</a>
                    </li>
                    <%-- <li>
                         <a href="../../pages/admin/Settlement_center.jsp"><i class="fa fa-bar-chart-o"></i> 结算中心</a>
                     </li>--%>
                    <li>
                        <a href="../../pages/admin/Report_center.jsp"><i class="fa fa-qrcode"></i> 报表中心</a>
                    </li>
                    <li>
                        <a href="../../pages/admin/Central_Archives.jsp"><i class="fa fa-history"
                                                                            aria-hidden="true"></i> 档案中心</a>
                    </li>
                    <li>
                        <a href="../../pages/admin/adminLogin.jsp"><i class="fa fa-outdent" aria-hidden="true"></i> 退出登录</a>
                    </li>
                </ul>
            </div>

        </nav>
    </div>
    <!-- /. NAV SIDE  -->
    <div class="col-10" style="height: 1200px;background: #fff;">
        <div style="margin-top: 100px">
            <c:if test="${empty sessionScope.repairsList}">
                <p>暂时还没有维修内容</p>
            </c:if>
            <c:if test="${not empty sessionScope.repairsList}">
                <c:forEach items="${sessionScope.repairsList}" var="list">
                    <c:if test="${list.maintenanceCosts==-1}">
                        <p>
                            <a class="btn btn-success w-100" data-toggle="collapse" href="#collapseExample1"
                               role="button"
                               aria-expanded="false" aria-controls="collapseExample1">
                                (未确认)报修用户：${list.request_people}----------维修项目：${list.repair_project}----------联系电话：${list.phone}(单击详情)
                            </a>
                        </p>
                        <div class="collapse" id="collapseExample1">
                            <div class="card card-body">
                                <form method="post" action="/updateReapir" id="pass">
                                    <label for="id">维修单号</label>
                                    <input name="id" id="id" value="${list.id}" readonly>
                                    <br>
                                    <label for="userId">用户ID</label>
                                    <input name="userId" id="userId" value="${list.userId}" readonly>
                                    <br>
                                    <label for="repair_project">维修项目</label>
                                    <input name="repair_project" id="repair_project" value="${list.repair_project}"
                                           readonly>
                                    <br>
                                    <label for="housing_estate">小区</label>
                                    <input name="housing_estate" id="housing_estate" value="${list.housing_estate}"
                                           readonly>
                                    <br>
                                    <label for="address">详细地址</label>
                                    <input name="address" id="address" value="${list.address}" readonly>
                                    <br>
                                    <label for="phone">联系电话</label>
                                    <input name="phone" id="phone" value="${list.phone}" readonly>
                                    <br>
                                    <label for="request_people">报修用户</label>
                                    <input name="request_people" id="request_people" value="${list.request_people}"
                                           readonly>
                                    <br>
                                    <label for="description">描述</label>
                                    <input name="description" id="description" value="${list.description}" readonly>
                                    <br>
                                    <label for="maintenanceCosts">应收金额</label>
                                    <input name="maintenanceCosts" id="maintenanceCosts" placeholder="输入维修费用">
                                    <br>
                                    <label for="feesPaid">已收金额</label>
                                    <input name="feesPaid" id="feesPaid" value="${list.feesPaid}" readonly>
                                    <input type="button" class="btn btn-primary" value="确认维修" onclick="checkSubmit()">
                                </form>
                            </div>
                        </div>
                    </c:if>
                    <c:if test="${list.maintenanceCosts!=-1}">
                        <p>
                            <a class="btn btn-danger w-100" data-toggle="collapse" href="#collapseExample2"
                               role="button"
                               aria-expanded="false" aria-controls="collapseExample2">
                                (已确认)报修用户：${list.request_people}----------维修项目：${list.repair_project}----------联系电话：${list.phone}(单击详情)
                            </a>
                        </p>
                        <div class="collapse" id="collapseExample2">
                            <div class="card card-body">
                                维修单号:${list.id}
                                <br>
                                用户ID:${list.userId}
                                <br>
                                维修项目:${list.repair_project}
                                <br>
                                小区:${list.housing_estate}
                                <br>
                                详细地址:${list.address}
                                <br>
                                联系电话:${list.phone}
                                <br>
                                报修用户:${list.request_people}
                                <br>
                                描述:${list.description}
                                <br>
                                应收金额:${list.maintenanceCosts}
                                <br>
                                已收金额:${list.feesPaid}
                            </div>
                        </div>
                    </c:if>
                </c:forEach>
            </c:if>
        </div>
    </div>


</div>
</body>
<script>
    function checkSubmit() {
        if ($("#maintenanceCosts") == "") {
            alert("请输入维修费用");
            $("#maintenanceCosts").focus();
            return false
        }
        $("#pass").submit();
    }
</script>
</html>
